home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / FireMan.swf / scripts / frame_1134 / PlaceObject2_783_84 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2008-09-12  |  3KB  |  110 lines

  1. onClipEvent(enterFrame){
  2.    function doexplode()
  3.    {
  4.       myColor.setTransform(myColorNormal);
  5.       this.gotoAndStop("death");
  6.    }
  7.    function dorespawn()
  8.    {
  9.       currentdamage = 0;
  10.       hitted = false;
  11.       flashing = false;
  12.       timerdamage = 0;
  13.       death = false;
  14.       this.gotoAndStop("standing");
  15.       v = false;
  16.    }
  17.    _X = _X - heroe.scrollspeed;
  18.    _Y = _Y - heroe.vscrollspeed;
  19.    hitable = this.hitTest(_parent.mascara);
  20.    if(hitable)
  21.    {
  22.       _visible = true;
  23.       if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
  24.       {
  25.          heroe.damage = 2;
  26.          heroe.hitted = true;
  27.       }
  28.       if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
  29.       {
  30.          hitted = true;
  31.          _root.shoot1.impact = true;
  32.          _root.hitted.start();
  33.       }
  34.       if(timerdamage == 0 && hitted)
  35.       {
  36.          timerdamage = FLASHTIME;
  37.          currentdamage += DAMAGE;
  38.       }
  39.       if(timerdamage > 0)
  40.       {
  41.          flashing = true;
  42.          timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
  43.          timerdamage--;
  44.       }
  45.       if(flashing && timerdamage == 0)
  46.       {
  47.          flashing = false;
  48.          myColor.setTransform(myColorNormal);
  49.          hitted = false;
  50.       }
  51.       if(currentdamage >= MAXDAMAGE)
  52.       {
  53.          myColor.setTransform(myColorTransform);
  54.          death = true;
  55.       }
  56.       if(death && !v)
  57.       {
  58.          _root.shoot1.impact = false;
  59.          _root.windx = 0;
  60.          v = true;
  61.       }
  62.       if(!death)
  63.       {
  64.          if(attack)
  65.          {
  66.             this.gotoAndStop("attack");
  67.             attack = false;
  68.             attacking = true;
  69.             c = 0;
  70.             sentido *= -1;
  71.          }
  72.          if(attacking)
  73.          {
  74.             this.gotoAndStop("attack");
  75.             _root.windx = heroe.hforce * 0.6 * sentido;
  76.             c += 1;
  77.             if(c >= attackTIME)
  78.             {
  79.                attacking = false;
  80.                change = true;
  81.                c = 0;
  82.                _root.windx = 0;
  83.             }
  84.          }
  85.          if(change)
  86.          {
  87.             this.gotoAndStop("change");
  88.             c += 1;
  89.             if(c >= 16)
  90.             {
  91.                change = false;
  92.                attack = true;
  93.             }
  94.          }
  95.       }
  96.       else
  97.       {
  98.          doexplode();
  99.       }
  100.    }
  101.    else
  102.    {
  103.       _visible = false;
  104.       if(death && Math.abs(heroe._x - _X) >= 200)
  105.       {
  106.          dorespawn();
  107.       }
  108.    }
  109. }
  110.